import React from 'react';
import ReactDOM from 'react-dom';
// import 'babel-polyfill';
// import largeNumber from 'large-number-kimmy';
// import './search.css';
// import './search_second.css'
import './search.less';
import logo from './images/avatar.png';
import bg from './images/bg.png';
import '../../common';
import { a } from './tree-shaking';

// const largeNumber = require('large-number-kimmy');

class Search extends React.Component {
  state = {
    Text: null,
  }

  loadComponent = () => {
    // 动态加载Text组件
    import('./text.js').then((Text) => {
      this.setState({ Text: Text.default });
    });
  }

  render() {
    const aRes = a();
    const { Text } = this.state;
    // const addRes = largeNumber('999', '123');
    return (
      <div className="search-text">
        Search Text Love you
        { aRes }
        <br />
        加法结果：
        {/* { addRes } */}
        <div className="second-text">This is second title</div>
        { Text ? <Text /> : null }
        <img src={logo} onClick={this.loadComponent} alt="" />
        <img src={bg} alt="" />
      </div>
    );
  }
}

ReactDOM.render(
  <Search />,
  document.getElementById('root'),
);
